<template>
    <div>
        <h1>子组件</h1>
        <p @click="change">子传父</p>
        {{ props.num }}
        {{ props.car }}
        <h1>跨级传参</h1>
        {{ name }}
    </div>
</template>

<script setup>
import { inject,ref } from 'vue';
const props = defineProps({
    num: Number,
    car: String
})
// 子传父
const emit = defineEmits(['changeEmit'])
const change = () => {
    emit('changeEmit', 1000)
}
// 跨级传参
const name = inject('name')

// ref获取dom
const num = ref('000')
defineExpose({ num })
</script>

<style lang="scss" scoped>

</style>